﻿using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using GalaSoft.MvvmLight.Messaging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ZFSDomain.ViewModel.Step
{
    /// <summary>
    /// 信息提示窗口
    /// </summary>
    public class MsgBoxViewModel : ViewModelBase
    {
        #region 属性

        private string msg;
        private string icon;
        private string color;
        private bool visibility;

        /// <summary>
        /// 字体
        /// </summary>
        public string Icon
        {
            get { return icon; }
            set { icon = value; RaisePropertyChanged(); }
        }

        /// <summary>
        /// 信息
        /// </summary>
        public string Msg
        {
            get { return msg; }
            set { msg = value; RaisePropertyChanged(); }
        }

        /// <summary>
        /// 颜色
        /// </summary>
        public string Color
        {
            get { return color; }
            set { color = value; RaisePropertyChanged(); }
        }

        /// <summary>
        /// 是否隐藏
        /// </summary>
        public bool BtnHide
        {
            get { return visibility; }
            set { visibility = value; RaisePropertyChanged(); }
        }

        #endregion

        #region 命令

        private RelayCommand _saveCommand;
        private RelayCommand _cancelCommand;

        /// <summary>
        /// 确定
        /// </summary>
        public RelayCommand SaveCommand
        {
            get
            {
                if(_saveCommand==null)
                {
                    _saveCommand = new RelayCommand(() => Save());
                }
                return _saveCommand;
            }
            set
            {
                _saveCommand = value;RaisePropertyChanged();
            }
        }

        /// <summary>
        /// 取消
        /// </summary>
        public RelayCommand CancelCommand
        {
            get
            {
                if (_cancelCommand == null)
                {
                    _cancelCommand = new RelayCommand(() => Cancel());
                }
                return _cancelCommand;
            }
            set
            {
                _cancelCommand = value; RaisePropertyChanged();
            }
        }

        /// <summary>
        /// 保存
        /// </summary>
        private void Save()
        {
            Messenger.Default.Send("", "Save");
        }

        /// <summary>
        /// 取消
        /// </summary>
        private void Cancel()
        {
            Messenger.Default.Send("", "Cancel");
        }


        #endregion

    }
}
